﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WCFServer
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServerManager" in code, svc and config file together.
    public class ServerManager : IServerManager
    {

        
        public void writeNewMessageToDb(WcfMessage msg, string connectionString)
        {
            try
            {
                DbManager.insertNewMessage(msg, connectionString);

            }
            catch (Exception ex)
            {

            }
        }
       
        public List<WcfMessage> getMessages(string sqlQuery, List<WcfParameter> parameters, string connectionString)
        {
            return DbManager.getMessages(sqlQuery, parameters, connectionString);
        }


        public void markMessageAsRead(string sqlQuery, List<WcfParameter> parameters, string connectionString)
        {
            DbManager.markAsRead(sqlQuery, parameters, connectionString);
        }






        public List<WcfMsgAttribute> getMessageAttributes(int msgID, string connectionString)
        {
            return DbManager.getMessageAttributes(msgID, connectionString);
        }

        
    }
}
